package com.hitqz.robot.dispatch.netty.factory;

import com.google.common.collect.Maps;
import com.hitqz.robot.dispatch.netty.strategy.AlgorithmStrategy;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * @author xupkun
 * @date 2024/8/19
 */
@Component
public class AlgorithmFactory {


    private final Map<String, AlgorithmStrategy> routingStrategies = Maps.newHashMap();


    public AlgorithmFactory(Map<String, AlgorithmStrategy> routingStrategies) {
        this.routingStrategies.clear();
        this.routingStrategies.putAll(routingStrategies);
    }

    public AlgorithmStrategy getRoutingStrategy(String strategy) {
        return this.routingStrategies.get(strategy);
    }




}
